package com.medical.utils;

import com.google.code.kaptcha.Producer;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

import java.awt.image.BufferedImage;
import java.util.*;

/**
 * @author TISNIW
 * @version 1.0
 * @desc
 */
@Component
public class CaptchaUtil {

    @Resource(name = "captchaProducer")
    private Producer captchaProducer;

    public String generateCaptchaText() {
        return captchaProducer.createText();
    }

    public BufferedImage generateCaptchaImage(String text) {
        return captchaProducer.createImage(text);
    }
}
